home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1995 March / PC Plus Super CD (Issue 101) (March 1995).iso / pcplus / superdsk / visbasic / snapshot.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-11-29  |  18.6 KB  |  588 lines

  1. VERSION 2.00
  2. Begin Form Main 
  3.    BackColor       =   &H00000000&
  4.    Caption         =   "SnapShot 1.1"
  5.    ClientHeight    =   5910
  6.    ClientLeft      =   375
  7.    ClientTop       =   1815
  8.    ClientWidth     =   7395
  9.    ClipControls    =   0   'False
  10.    FillColor       =   &H00C00000&
  11.    FillStyle       =   0  'Solid
  12.    Height          =   6600
  13.    HelpContextID   =   3
  14.    Icon            =   0
  15.    Left            =   315
  16.    LinkTopic       =   "Form1"
  17.    MaxButton       =   0   'False
  18.    ScaleHeight     =   5910
  19.    ScaleWidth      =   7395
  20.    Top             =   1185
  21.    Width           =   7515
  22.    Begin DriveListBox Drive1 
  23.       BackColor       =   &H00FFFFFF&
  24.       Height          =   315
  25.       HelpContextID   =   3
  26.       Left            =   240
  27.       TabIndex        =   3
  28.       Top             =   840
  29.       Width           =   2295
  30.    End
  31.    Begin Timer Timer2 
  32.       Interval        =   100
  33.       Left            =   3960
  34.       Top             =   3240
  35.    End
  36.    Begin Timer Timer1 
  37.       Interval        =   100
  38.       Left            =   3180
  39.       Top             =   3240
  40.    End
  41.    Begin CheckBox Check1 
  42.       Alignment       =   1  'Right Justify
  43.       BackColor       =   &H00800000&
  44.       Caption         =   "Recycle Slides:"
  45.       ForeColor       =   &H0000FFFF&
  46.       Height          =   315
  47.       HelpContextID   =   3
  48.       Left            =   3060
  49.       TabIndex        =   6
  50.       Top             =   4980
  51.       Width           =   1695
  52.    End
  53.    Begin TextBox Text1 
  54.       Alignment       =   2  'Center
  55.       BackColor       =   &H00800000&
  56.       BorderStyle     =   0  'None
  57.       ForeColor       =   &H0000FFFF&
  58.       Height          =   255
  59.       HelpContextID   =   3
  60.       Left            =   4500
  61.       TabIndex        =   5
  62.       Text            =   "5"
  63.       Top             =   4620
  64.       Width           =   255
  65.    End
  66.    Begin FileListBox File1 
  67.       BackColor       =   &H00FFFF00&
  68.       Height          =   4515
  69.       HelpContextID   =   4
  70.       Left            =   5220
  71.       MultiSelect     =   2  'Extended
  72.       Pattern         =   "*.bmp;*.wmf;*.ico;*.rle"
  73.       TabIndex        =   0
  74.       Top             =   840
  75.       Width           =   1935
  76.    End
  77.    Begin DirListBox Dir1 
  78.       BackColor       =   &H00FFFF00&
  79.       ForeColor       =   &H00000000&
  80.       Height          =   3405
  81.       HelpContextID   =   3
  82.       Left            =   240
  83.       TabIndex        =   1
  84.       Top             =   1560
  85.       Width           =   2295
  86.    End
  87.    Begin Image Image1 
  88.       BorderStyle     =   1  'Fixed Single
  89.       Height          =   2055
  90.       Left            =   2820
  91.       Stretch         =   -1  'True
  92.       Top             =   540
  93.       Width           =   2115
  94.    End
  95.    Begin Line Line3 
  96.       BorderColor     =   &H0000FFFF&
  97.       X1              =   1500
  98.       X2              =   1500
  99.       Y1              =   4980
  100.       Y2              =   5400
  101.    End
  102.    Begin Line Line2 
  103.       BorderColor     =   &H0000FFFF&
  104.       X1              =   180
  105.       X2              =   2580
  106.       Y1              =   4980
  107.       Y2              =   4980
  108.    End
  109.    Begin Line Line1 
  110.       BorderColor     =   &H0000FFFF&
  111.       X1              =   2760
  112.       X2              =   4980
  113.       Y1              =   4380
  114.       Y2              =   4380
  115.    End
  116.    Begin Label Tym 
  117.       Alignment       =   2  'Center
  118.       BackColor       =   &H00FFFFFF&
  119.       BackStyle       =   0  'Transparent
  120.       FontBold        =   -1  'True
  121.       FontItalic      =   0   'False
  122.       FontName        =   "MS Sans Serif"
  123.       FontSize        =   9.75
  124.       FontStrikethru  =   0   'False
  125.       FontUnderline   =   0   'False
  126.       ForeColor       =   &H00FFFFFF&
  127.       Height          =   255
  128.       Left            =   1620
  129.       TabIndex        =   4
  130.       Top             =   5100
  131.       Width           =   855
  132.    End
  133.    Begin Label Datum 
  134.       Alignment       =   2  'Center
  135.       BackColor       =   &H00FFFFFF&
  136.       BackStyle       =   0  'Transparent
  137.       FontBold        =   -1  'True
  138.       FontItalic      =   0   'False
  139.       FontName        =   "MS Sans Serif"
  140.       FontSize        =   9.75
  141.       FontStrikethru  =   0   'False
  142.       FontUnderline   =   0   'False
  143.       ForeColor       =   &H00FFFFFF&
  144.       Height          =   255
  145.       Left            =   300
  146.       TabIndex        =   10
  147.       Top             =   5100
  148.       Width           =   1095
  149.    End
  150.    Begin Line Line11 
  151.       BorderColor     =   &H0000FFFF&
  152.       X1              =   180
  153.       X2              =   2580
  154.       Y1              =   1200
  155.       Y2              =   1200
  156.    End
  157.    Begin Label DriveLabel 
  158.       BackStyle       =   0  'Transparent
  159.       Caption         =   " Drive"
  160.       ForeColor       =   &H00FFFFFF&
  161.       Height          =   630
  162.       Left            =   240
  163.       TabIndex        =   2
  164.       Top             =   540
  165.       Width           =   2295
  166.    End
  167.    Begin Label FileLabel 
  168.       BackStyle       =   0  'Transparent
  169.       Caption         =   " File(s)"
  170.       ForeColor       =   &H00FFFFFF&
  171.       Height          =   255
  172.       Left            =   5220
  173.       TabIndex        =   13
  174.       Top             =   540
  175.       Width           =   1875
  176.    End
  177.    Begin Label PathLabel 
  178.       BackStyle       =   0  'Transparent
  179.       Caption         =   " Path"
  180.       ForeColor       =   &H00FFFFFF&
  181.       Height          =   255
  182.       Left            =   270
  183.       TabIndex        =   12
  184.       Top             =   1260
  185.       Width           =   2280
  186.    End
  187.    Begin Label InfoLabel 
  188.       Alignment       =   2  'Center
  189.       BackColor       =   &H00C0C0C0&
  190.       ForeColor       =   &H00FF0000&
  191.       Height          =   1635
  192.       Left            =   2820
  193.       TabIndex        =   11
  194.       Top             =   2700
  195.       Width           =   2115
  196.    End
  197.    Begin Label Message 
  198.       Alignment       =   2  'Center
  199.       BackColor       =   &H00000000&
  200.       ForeColor       =   &H0000FFFF&
  201.       Height          =   195
  202.       Left            =   60
  203.       TabIndex        =   7
  204.       Top             =   60
  205.       Width           =   7275
  206.    End
  207.    Begin Label MessageLabel 
  208.       AutoSize        =   -1  'True
  209.       BackColor       =   &H00000000&
  210.       ForeColor       =   &H0000FF00&
  211.       Height          =   255
  212.       Left            =   60
  213.       TabIndex        =   8
  214.       Top             =   5640
  215.       Width           =   7275
  216.    End
  217.    Begin Line Line4 
  218.       BorderColor     =   &H0000FFFF&
  219.       X1              =   2760
  220.       X2              =   4995
  221.       Y1              =   2640
  222.       Y2              =   2640
  223.    End
  224.    Begin Shape Shape3 
  225.       BackColor       =   &H00808080&
  226.       BackStyle       =   1  'Opaque
  227.       BorderColor     =   &H0000FFFF&
  228.       FillColor       =   &H00FF0000&
  229.       FillStyle       =   0  'Solid
  230.       Height          =   4935
  231.       Left            =   180
  232.       Top             =   480
  233.       Width           =   2415
  234.    End
  235.    Begin Label SlideLabel 
  236.       Alignment       =   2  'Center
  237.       BackColor       =   &H00808080&
  238.       BackStyle       =   0  'Transparent
  239.       Caption         =   "Slide Interval:"
  240.       ForeColor       =   &H0000FFFF&
  241.       Height          =   255
  242.       Left            =   3060
  243.       TabIndex        =   9
  244.       Top             =   4620
  245.       Width           =   1335
  246.    End
  247.    Begin Shape Shape2 
  248.       BackColor       =   &H00800000&
  249.       BackStyle       =   1  'Opaque
  250.       BorderColor     =   &H00C0C0C0&
  251.       Height          =   495
  252.       Left            =   2820
  253.       Top             =   4440
  254.       Width           =   2115
  255.    End
  256.    Begin Shape Shape1 
  257.       BorderColor     =   &H0000FFFF&
  258.       Height          =   4935
  259.       Left            =   2760
  260.       Top             =   480
  261.       Width           =   2235
  262.    End
  263.    Begin Shape Shape8 
  264.       BackColor       =   &H00800000&
  265.       BackStyle       =   1  'Opaque
  266.       BorderColor     =   &H00C0C0C0&
  267.       Height          =   435
  268.       Left            =   2820
  269.       Top             =   4920
  270.       Width           =   2115
  271.    End
  272.    Begin Shape Shape4 
  273.       BackColor       =   &H00FF0000&
  274.       BackStyle       =   1  'Opaque
  275.       BorderColor     =   &H0000FFFF&
  276.       Height          =   4935
  277.       Left            =   5160
  278.       Top             =   480
  279.       Width           =   2055
  280.    End
  281.    Begin Shape Shape5 
  282.       BackColor       =   &H00000000&
  283.       BackStyle       =   1  'Opaque
  284.       Height          =   2055
  285.       Left            =   2820
  286.       Top             =   540
  287.       Width           =   2115
  288.    End
  289.    Begin Shape Shape9 
  290.       BackColor       =   &H0000FFFF&
  291.       BackStyle       =   1  'Opaque
  292.       BorderColor     =   &H0000FFFF&
  293.       FillColor       =   &H00000080&
  294.       FillStyle       =   0  'Solid
  295.       Height          =   5295
  296.       Left            =   0
  297.       Top             =   300
  298.       Width           =   7395
  299.    End
  300.    Begin Menu exit 
  301.       Caption         =   "  &Exit"
  302.    End
  303.    Begin Menu space1 
  304.       Caption         =   "                                        "
  305.    End
  306.    Begin Menu View 
  307.       Caption         =   "&View"
  308.    End
  309.    Begin Menu space2 
  310.       Caption         =   "                         "
  311.    End
  312.    Begin Menu Help 
  313.       Caption         =   "&Help = F1"
  314.    End
  315. Dim Shared cfg As String * 50, Pad As String * 47, FName$
  316. Dim Shared Messag$, DriveName As String * 2
  317. Sub Check1_Click ()
  318. cycle = check1.Value
  319. End Sub
  320. Sub Check1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  321. Message.Caption = "Click to make the slide show repeat itself after the given slide delay"
  322. End Sub
  323. Sub Datum_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  324. Message.Caption = "Yep, it's " + Format$(Now, "dddd, mmmm d, yyyy")
  325. End Sub
  326. Sub Dir1_Change ()
  327. 'Unload picture when path changes
  328. File1.Path = Dir1.Path
  329. image1.Picture = LoadPicture()
  330. InfoLabel.Caption = ""
  331. End Sub
  332. Sub Dir1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  333. Message.Caption = "Choose a new path for your files by double-clicking the folder"
  334. End Sub
  335. Sub Drive1_Change ()
  336. On Error GoTo nodrive
  337. ' When Drive changes, set Dir path
  338. Dir1.Path = drive1.Drive
  339. DriveName = drive1.Drive
  340. image1.Picture = LoadPicture()
  341. InfoLabel.Caption = ""
  342. Exit Sub
  343. 'Error-Handler if drive not available
  344. nodrive:
  345. Beep: MsgBox "Cannot read from drive " + UCase$(drive1.Drive) + " ", 16, "Error"
  346. drive1.Drive = DriveName: Exit Sub
  347. Resume Next
  348. End Sub
  349. Sub DriveLabel_Click ()
  350. drive1.SetFocus
  351. End Sub
  352. Sub DriveLabel_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  353. Message.Caption = "Choose a new drive to access by clicking on the drive icon"
  354. End Sub
  355. Sub exit_Click ()
  356. 'Save the defaults (delay,cycle,path)
  357. 'They are saved in the directory user started SnapShot
  358. Dim DefSave As String * 2, DefSave2 As String * 2
  359. DefSave = LTrim$(Str$(delay)): If Len(DefSave) = 1 Then DefSave = "0" + DefSave
  360. DefSave2 = LTrim$(Str$(cycle))
  361. FNum = FreeFile
  362. Open app.Path + "\snapshot.cfg" For Random As FNum Len = Len(cfg)
  363. cfg = DefSave + DefSave2 + Dir1.Path
  364. Put FNum, 1, cfg
  365. Close FNum
  366. 'Program ends here
  367. 'If you exit by means of the control box of the form
  368. 'the defaults are not saved!
  369. End Sub
  370. Sub file1_click ()
  371. On Error GoTo fault
  372. Timer1.Enabled = True
  373. PictureName$ = Dir1.Path
  374. If Right$(PictureName$, 1) <> "\" Then PictureName$ = PictureName$ + "\"
  375. PictureName$ = PictureName$ + File1.FileName
  376. FName$ = File1.FileName
  377. InfoLabel.Caption = "FileName:" + Chr$(13) + UCase$(FName$) + Chr$(13) + Chr$(13) + "FileSize: " + Chr$(13) + Str$(FileLen(PictureName$)) + " bytes" + Chr$(13) + Chr$(13) + "Last modified on:" + Chr$(13) + FileDateTime(PictureName$)
  378. image1.Visible = False
  379. image1.Height = 2055
  380. image1.Width = 2115
  381. image1.Picture = LoadPicture(PictureName$)
  382. image1.Visible = True
  383. Exit Sub
  384. 'Error Handler
  385. fault:
  386. Beep: MsgBox File1.FileName + " is" + Chr$(10) + "an " + Error$(Err), 16, "Error"
  387. image1.Picture = LoadPicture()
  388. Resume Next
  389. End Sub
  390. Sub File1_DblClick ()
  391. slide = 0: Full.Show
  392. End Sub
  393. Sub File1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  394. Pad = Dir1.Path
  395. Message.Caption = "Select one or more pictures from the File(s) list and activate 'View'"
  396. End Sub
  397. Sub File1_PathChange ()
  398. PictureName$ = Dir1.Path
  399. End Sub
  400. Sub FileLabel_Click ()
  401. 'If files have been modified or added,
  402. 'updating of the file(s) list
  403. File1.Path = Dir1.Path
  404. File1.Refresh
  405. image1.Picture = LoadPicture()
  406. InfoLabel.Caption = ""
  407. File1.SetFocus
  408. End Sub
  409. Sub FileLabel_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  410. Pad = Dir1.Path
  411. Message.Caption = "Click here to refresh and/or update the files list"
  412. End Sub
  413. Sub form_load ()
  414. On Error GoTo Faults
  415. Randomize Timer
  416. top = (screen.Height - Height) / 2
  417. left = (screen.Width - Width) / 2
  418. Timer1.Interval = 65000
  419. app.HelpFile = "snapshot.hlp"
  420. MessageLabel.ForeColor = QBColor(Rnd * 5 + 10)
  421. DriveName = drive1.Drive
  422. 'The data for scrolling the message bar
  423. Messag$ = String$(86, 32)
  424. Messag$ = Messag$ + "SnapShot - version 1.1 - Pcs 1994 -                         "
  425. Messag$ = Messag$ + "This is a free program to use and to copy as long as you mention "
  426. Messag$ = Messag$ + "the original author - which is PcS - if you change any of the supplied files !"
  427. Messag$ = Messag$ + "             The thing which would please me the most is for you to send me a postcard "
  428. Messag$ = Messag$ + "with your greetings to:      PcS - Molenstraat 106 - 2940 Hoevenen - Belgium ....."
  429. Messag$ = Messag$ + "                  Thank you for your trouble and enjoy .......                             "
  430. delay = 5: cycle = 0
  431. 'Read the configuration file if any
  432. 'and fill in the variables
  433. FNum = FreeFile
  434. Open app.Path + "\snapshot.cfg" For Random As FNum Len = Len(cfg)
  435. If LOF(FNum) / Len(cfg) = 1 Then
  436. Rem cfg = a$ + b$ + Pad
  437. Get FNum, 1, cfg
  438. delay = Val(Left$(cfg, 2))
  439. cycle = Val(Mid$(cfg, 3, 1))
  440. Pad = RTrim$(Mid$(cfg, 4))
  441. Dir1.Path = Pad
  442. drive1.Drive = Dir1.Path
  443. End If
  444. Close FNum
  445. Text1.Text = LTrim$(Str$(delay))
  446. Text1.SelLength = Len(Text1.Text)
  447. Text1.MaxLength = 2
  448. check1.Value = cycle
  449. Exit Sub
  450. 'Error-Handler if path not found
  451. Faults:
  452. Resume nopad
  453. nopad:
  454. drive1.Drive = "c:"
  455. Dir1.Path = "c:\"
  456. End Sub
  457. Sub Form_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  458. Message.Caption = ""
  459. End Sub
  460. Sub Form_Resize ()
  461. 'Set default form height and width if user resizes window
  462. 'Not if minimized
  463. If windowstate <> 0 Then Exit Sub
  464. Width = 7515
  465. Height = 6525
  466. End Sub
  467. Sub Help_Click ()
  468. File1.HelpContextID = 1
  469. SendKeys "{F1}", True
  470. File1.HelpContextID = 4
  471. End Sub
  472. Sub Image1_Click ()
  473. On Error GoTo nocopy
  474. 'If valid picture loaded, copy picture to the ClipBoard
  475. If FName$ <> "" Then
  476.     If Right$(PictureName$, 4) <> ".ico" Then
  477.         Clipboard.SetData LoadPicture(PictureName$), 8
  478.         MsgBox UCase$(PictureName$) + " saved to ClipBoard", 64, "Copy Successful"
  479.     Else
  480.         MsgBox "Sorry, icons (ICO) cannot be copied to the ClipBoard", 16, "Error"
  481.     End If
  482. End If
  483. nocopy2:
  484. Exit Sub
  485. 'Error Handler
  486. nocopy:
  487. MsgBox Error$(Err), 16, "Error"
  488. Resume nocopy2
  489. End Sub
  490. Sub Image1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  491. On Error GoTo nopb
  492. Static imedit As Integer
  493. If Button = 2 Then
  494.     If FName$ <> "" Then
  495.         If Right$(FName$, 3) <> "bmp" Then
  496.             Beep: MsgBox "Sorry, PAINTBRUSH can only load BMP files", 16, "Error"
  497.             Exit Sub
  498.         End If
  499.         imedit = Shell("c:\windows\pbrush" + " " + PictureName$, 3)
  500.     Else
  501.         imedit = Shell("c:\windows\pbrush", 3)
  502.     End If
  503. End If
  504. Exit Sub
  505. nopb:
  506. Beep: MsgBox "Program PBRUSH.EXE was not" + Chr$(10) + "found in directory C:\WINDOWS", 16, "Error": Resume Next
  507. End Sub
  508. Sub Image1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  509. Message.Caption = "Left-Click picture to copy to CLIPBOARD, right-click to load into PAINTBRUSH"
  510. End Sub
  511. Sub InfoLabel_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  512. Message.Caption = "Here's some useful information about the selected file (if one is selected !)"
  513. End Sub
  514. Sub Message_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  515. Message.Caption = "If you haven't guessed it already, this is the message bar"
  516. End Sub
  517. Sub MessageLabel_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  518. Message.Caption = "What'd you know, a scrolling advertizing bar ! Please read carefully !"
  519. End Sub
  520. Sub PathLabel_Click ()
  521. Dir1.SetFocus
  522. End Sub
  523. Sub PathLabel_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  524. Message.Caption = "Choose a new path for your files by double-clicking the folder"
  525. End Sub
  526. Sub SlideLabel_Click ()
  527. Text1.SetFocus
  528. End Sub
  529. Sub SlideLabel_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  530. Message.Caption = "Choose a delay between slides from 1 up to 60 seconds"
  531. End Sub
  532. Sub Text1_GotFocus ()
  533. 'Text1 is the input field for the slide show interval
  534. Text1.SelStart = 0
  535. Text1.SelLength = Len(Text1.Text)
  536. End Sub
  537. Sub Text1_KeyPress (keyascii As Integer)
  538. If keyascii = 13 Then File1.SetFocus
  539. End Sub
  540. Sub Text1_LostFocus ()
  541. delay = Val(Text1.Text): If delay < 1 Or delay > 60 Then delay = 5: Text1.Text = "5"
  542. End Sub
  543. Sub Timer1_Timer ()
  544. Tym.Caption = Left$(Time$, 5)
  545. Datum.Caption = Format$(Now, "mm-dd-yy")
  546. End Sub
  547. Sub Timer2_Timer ()
  548. Randomize Timer
  549. Static loop1, loop2
  550. loop1 = Len(Messag$)
  551. loop2 = loop2 + 1
  552. If loop2 = loop1 - 86 Then
  553. loop2 = 1
  554. MessageLabel.ForeColor = QBColor(Rnd * 5 + 10)
  555. End If
  556. MessageLabel.Caption = Mid$(Messag$, loop2, 86)
  557. End Sub
  558. Sub Tym_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
  559. Message.Caption = "Keep an eye on the time while you browse your files"
  560. End Sub
  561. Sub view_click ()
  562. Dim loop1 As Integer, flag As Integer
  563. 'Flag indicates if only or several pictures are selected
  564. flag = 0
  565. File1.SetFocus
  566. If File1.ListCount = 0 Then Exit Sub
  567. For loop1 = 0 To File1.ListCount - 1
  568.     If File1.Selected(loop1) = True Then
  569.         flag = flag + 1
  570.         If flag > 1 Then Exit For
  571.     End If
  572. If flag = 0 Then Beep: Exit Sub
  573. If flag = 1 Then
  574.     If FName$ <> "" Then
  575.         Timer1.Enabled = False
  576.         timer2.Enabled = False
  577.         slide = 0
  578.         Full.Show
  579.         Exit Sub
  580.     End If
  581. End If
  582. Timer1.Enabled = False
  583. timer2.Enabled = False
  584. slide = 1
  585. Full.Timer1.Enabled = True
  586. Full.Show
  587. End Sub
  588.